package cn.toolck.minitomcat.container;

import cn.toolck.minitomcat.service.Connector;
import cn.toolck.minitomcat.service.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName Server
 * @Description TODO
 * @Author Toolck Rin
 * @Date 2021/3/18 0:48
 * @Version 1.0
 **/
public class Server {
    private List<Service> services = new ArrayList<>();
    ;

    public List<Service> getServices() {
        return services;
    }

    public void setServices(List<Service> services) {
        this.services = services;
    }

    public void start() {
        services.forEach(service -> {
            service.getConnectors().forEach(connector -> {
                new Thread(connector).start();
            });
        });
    }
}
